Stencil computations are typically performed on a two- or three-dimensional grid of data. In a stencil computation, the value of a cell of the grid is updated based on the values of other nearby cells. Typically, stencil computations are performed by iterating through a grid in one dimension (say, the x-dimension) and updating the value of each visited cell based on nearby cells. For a two-dimensional grid, typically each cell C is updated based on a cell “above” cell C (i.e., a cell that is k positions away from cell C in the positive y-direction, where k is a positive integer) and a cell “below” cell C (i.e., a cell that is k positions away from cell C in the negative y-direction). Typically the two neighbors in the y-direction are the same distance from cell C, so that, for example, a cell C may be updated based on the cells immediately above and below cell C, or based on the cells that are two positions above and two positions below cell C, or based on the cells that are three positions above and three positions below cell C, etc.
As another example, in a three-dimensional grid with dimensions labeled x, y, and z, the value of a cell C may be updated based on:                the value of the cell that is three positions away from cell C in the positive y-direction,        the value of the cell that is three positions away from cell C in the negative y-direction,        the value of the cell that is five positions away from cell C in the positive z-direction, and        the value of the cell that is five positions away from cell C in the negative z-direction.In the above three-dimensional example, the distance in the y-direction, known as the y stride, is three, and the distance in the z-direction, known as the z stride, is five.        
Stencil computations arise in a variety of scientific and engineering applications, such as reverse time migration (RTM) calculations for seismic imaging in oil and gas exploration, numerical methods for partial differential equations, and digital image processing.